package cn.sail.shiroAuthenticator.controller;

import cn.sail.pojo.vo.RespResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class MVCExceptionHandlerController {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public RespResult HandlerRuntimeException(RuntimeException e){
        e.printStackTrace();
        System.out.println("handlerRuntimeExceptions");
        RespResult respResult = new RespResult<>();
        respResult.setCode(RespResult.RespCodeTypeEnum.FAILED.getValue());
        respResult.setMessage(e.getMessage());

        return respResult;
    }


}
